<template>
  <el-dialog
    :title="type===0?'系统公告':'店铺公告'"
    :visible.sync="dialogVisible"
    width="300px">
    <div v-if="detail.id>0">
      <h5 style="font-size: 16px; font-weight: bold; text-align: center" v-text="detail.title"></h5>
      <div style="width: 95%; margin: 5px auto; text-indent: 30px; padding-bottom: 30px;" v-html="detail.content"></div>
      <div style="text-align: right; font-size: 12px; color: #888888" v-text="detail.createdTime"></div>
    </div>
  </el-dialog>

</template>

<script>
export default {
  name: 'ShowNoticeDialog',
  data: function () {
    return {
      type: 0,
      dialogVisible: false,
      detail: {
        id: 0,
        title: '',
        content: '',
        createdTime: '',
      },
    }
  },
  mounted () {
    let $this = this
    $this.bus.$on('BackKeyCallBus',function (){
      $this.dialogVisible=false
      $this.$forceUpdate()
    })
    $this.bus.$on('ShowNoticeDialogCallBus', function (detail, type) {
      $this.dialogVisible = true
      if (type===0){
        localStorage.setItem('ShowNotice_'+type,detail.id)
      }else{
        localStorage.setItem( 'ShowNotice_'+detail.shopId+'_1',detail.id)
      }
      // localStorage.setItem('ShowNotice_'+type,detail.id)
      $this.type = type
      $this.detail = detail
      $this.$forceUpdate()
    })

  },
  methods: {}
}
</script>

<style scoped>

</style>
